﻿using System;
namespace PageAdmin.Utils.ORM
{
    /// <summary>
    /// 实体附件映射特性
    /// </summary
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
    public class AttachmentMappedAttribute : Attribute
    {
        public AttachmentMappedAttribute(string fieldName,string fileListPropertyName=null, bool listSyncLoad = false, bool detailSyncLoad = true, string fileListField= "Name,Domain,Path,Thumbnail")
        {
            this.FieldName = fieldName;
            this.FileListPropertyName = fileListPropertyName;
            this.FileListField = fileListField;
            this.ListSyncLoad = listSyncLoad;
            this.DetailSyncLoad = detailSyncLoad;
        }
        /// <summary>
        /// 对应的附件字段名称
        /// </summary>
        public string FieldName { get; set; }

        /// <summary>
        /// 对应的附件字段名称
        /// </summary>
        public string FileListPropertyName { get; set; }

        /// <summary>
        /// 列出的附件数据字段
        /// </summary>
        public string FileListField { get; set; }


        /// <summary>
        /// 详情数据是否同步加载
        /// </summary>
        public bool DetailSyncLoad { get; set; }

        /// <summary>
        /// 列表数据是否同步加载
        /// </summary>
        public bool ListSyncLoad { get; set; }

    }

}
